var assert = require('assert');
var should = require('should');
var util = require('util');
var zlib = require('zlib');
var _ = require('lodash');
var rewardService = require('../../app/services/rewardService');
var config = require('../config');
var dataApi = require('../../app/libs/dataApi');
var dailyService = require('../../app/services/dailyService');
var missionService = require('../../app/services/missionService');
var consumeService = require('../../app/services/consumeService');
var PlayerManager = require('../../app/libs/playerManager');
var configUtil = require('../../app/util/configUtil');
var analyze = require('kc-analyze');

suite('analyze', function () {
    test('初始化', function (done) {
        var analyze_config = configUtil.load('analyze');
        var game_config = configUtil.load('game');
        analyze.initialize({
            host: analyze_config.host,
            server_id: game_config.server_id
        });
        done();
    });
});

suite('测试rewardService', function () {
    var player_manager = new PlayerManager(config.role_id);
    setup(function (done) {
        player_manager.getAllModel(function (err, model) {
            done();
        });
    });

    suite('addRewardListToRole', function () {
        // test('添加奖励', function () {
        //     var reward_list = [{
        //         reward_type: -1,
        //         reward: 100
        //     }, {
        //         reward_type: 2,
        //         reward: 100
        //     }, {
        //         reward_type: 3,
        //         reward: 3000101
        //     }, {
        //         reward_type: 4,
        //         reward: 210101
        //     }, {
        //         reward_type: 5,
        //         reward: config.equip_id
        //     }];
        //     rewardService.addRewardListToRole(player_manager, reward_list, false);
        // });

        // test('添加消耗品奖励', function () {
        //     var consume_all_conf = dataApi.consume.all();
        //     _.each(consume_all_conf, function (consume_item, consume_id) {
        //         var reward_list = consumeService.getRewardList(consume_id);
        //         // console.log('reward_list:', reward_list);
        //         rewardService.addRewardListToRole(player_manager, reward_list, false);
        //     });
        // });

        // test('添加每日任务奖励', function () {
        //     var daily_all_conf = dataApi.daily.all();
        //     _.each(daily_all_conf, function (daily_item, daily_id) {
        //         var reward_list = dailyService.getRewardList(daily_id);
        //         rewardService.addRewardListToRole(player_manager, reward_list, false);
        //     });
        // });

        // test('添加任务奖励', function () {
        //     var mission_all_conf = dataApi.mission.all();
        //     _.each(mission_all_conf, function (mission_item, mission_id) {
        //         var reward_list = missionService.getRewardList(mission_id);
        //         rewardService.addRewardListToRole(player_manager, reward_list, false);
        //     });
        // });
    });
});
